<template>
  <div class="customers">
    <van-sticky>
      <van-nav-bar :title="$route.meta.title" left-arrow @click-left="onClickLeft" style="width:100%;" />
    </van-sticky>
    <van-empty description="暂无客源" v-if="shopDataLists.length == 0" />
    <div v-for="(item,index) in shopDataLists" :key="index">
      <shoppeople :shoppeople="shopDataLists" />
    </div>
  </div>
</template>

<script>

import shoppeople from '@/components/shoppeople'
import Vue from 'vue';
import { Empty } from 'vant';

Vue.use(Empty);
export default {
  name: 'TouristSource',
  data () {
    return {
      searchVal: '',
      shopDataLists: [],
      user: JSON.parse(localStorage.getItem('userInfo'))
    }
  },
  created () {
    this.shopinfo()
  },
  methods: {
    onClickLeft () {
      this.$router.push({ name: 'controls' })
    },
    shopinfo () {
      this.$axios
        .get(`/shops/${this.user.id}/外卖/开启`)
        .then((res) => {
          this.shopDataLists = res.data.list;
        })
        .catch((err) => {
          console.error(err);
        });
    },
  },
  components: {
    shoppeople,
  }
}
</script>

<style lang="less" scoped>
html,
body {
  height: 100%;
  background-color: #f8f8f8;
}
.customers {
  .customer-search /deep/ .van-search {
    background-color: #f8f8f8;
  }
  .customer-search /deep/ .van-search__content {
    background-color: #fff;
  }
}
</style>